<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>欢迎进入系统</title>
    <link rel="shortcut icon" href="./favicon.png">
    <link rel="stylesheet" type="text/css" href="pageStyle.css">
    <style>
        .content {
            background-color: #607d8b29;
            position: relative;
            top: 0;
            left: 0;
            width: 100%;
            border-radius: 0;
        }

        .span-left {
            margin: 10px 0 10px 5px;
        }

        .span-right {
            position: absolute;
            right: 7%;
            cursor: pointer;
        }

        .span-right:hover {
            color: #843112;
        }

        iframe {
            position: relative;
            top: 0;
            left: 0;
            width: calc(100% - 6px);
            height: calc(90% + 4px);
            margin: 1px 2px 2px 1px;
            border: 2px solid #607d8b29;
            background-color: #9e9e9e29;
        }
    </style>

</head>
<body>
<div class="back">
    <div class="content">
        <span class="span-left">
            <%
                String id = (String) session.getAttribute("id");
                out.print("欢迎" + " " + id + " " + "登录");
            %>
        </span>
        <span id="exit" class="span-right">退出</span>
    </div>
    <script>
        let exit = document.getElementById("exit");
        exit.onclick = function () {
            const xhr = new XMLHttpRequest();
            xhr.open("GET", "login.do", false);

            xhr.onreadystatechange = function () {
                //这步为判断服务器是否正确响应
                if (xhr.readyState === 4 && xhr.status === 200) {
                    location.reload();
                }
            }
            xhr.send();
        }
    </script>

    <iframe src="<%=session.getAttribute("toGo")%>"></iframe>
</div>
</body>
</html>
